<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <base href="<%=basePath%>"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>
</head>
<body>
<form method="post" action="">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 留言管理</strong></div>
        <div class="padding border-bottom">
            <ul class="search">
                <li>
                    <button type="button" class="button border-green" id="checkall"><span class="icon-check"></span> 全选
                    </button>
                    <a href="<%=basePath%>permissionController.do?method=addPermissionUI"
                       class="button border-green">增加</a>
                    <button type="submit" class="button border-red"><span class="icon-trash-o"></span> 批量删除</button>
                </li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="120">权限ID</th>
                <th>父ID</th>
                <th>名称</th>
                <th>类型</th>
                <th>url他</th>
                <th>权限码</th>
                <th>状态箱</th>
                <th>图标</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${permissionList_db }" var="permission">
                <tr>
                    <td><input type="checkbox" name="id[]" value="1"/>
                            ${permission.permission_id }</td>
                    <td>${permission.p_id }</td>
                    <td>${permission.name }</td>
                    <td>${permission.type }</td>
                    <td>${permission.url }</td>
                    <td>${permission.permission_code }</td>
                    <td>${permission.state }</td>
                    <td>${permission.icon }</td>
                    <td>
                        <div class="button-group"><a class="button border-red"
                                                     href="<%=basePath%>permissionController.do?method=deletePermission&permission_idStr=${permission.permission_id }"
                                                     onclick="return del(1)"><span class="icon-trash-o"></span> 删除</a>
                            <a class="button border-red"
                               href="<%=basePath%>permissionController.do?method=updateUIPermission&permission_idStr=${permission.permission_id }"><span
                                    class="icon-trash-o"></span> 修改</a></div>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="9">
                    <div class="pagelist"><a href="">上一页</a> <span class="current">1</span><a href="">2</a><a
                            href="">3</a><a href="">下一页</a><a href="">尾页</a></div>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">

    function del(id) {
        if (confirm("您确定要删除吗?")) {

        }
    }

    $("#checkall").click(function () {
        $("input[name='id[]']").each(function () {
            if (this.checked) {
                this.checked = false;
            } else {
                this.checked = true;
            }
        });
    })

    function DelSelect() {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {
            var t = confirm("您确认要删除选中的内容吗？");
            if (t == false) return false;
        } else {
            alert("请选择您要删除的内容!");
            return false;
        }
    }

</script>
</body>
</html>